package DataStructureAndAlgorithm.AcWing_每日一题.贪心题;
import java.util.Scanner;
//链接：https://www.acwing.com/problem/content/3777/
//贪心思路
public class AcWing_3774 {
    public static void main(String[] args){
        Scanner in = new Scanner(System.in);
        int t = in.nextInt();
        int N = 100010;
        int[] nums = new int[N];
        int[] s1 = new int[N];
        int[] s2 = new int[N];
        for (int j = 0; j < t; j++){
            int n = in.nextInt();
            int m = in.nextInt();

            for (int i = 1; i <= n; i++){
                nums[i] = in.nextInt();
            }

            nums[++n] = m;
            s1[n] = 0;
            s2[n] = 0;

            for (int i = n - 1; i >= 0; i--){
                s1[i] = s1[i + 1];
                s2[i] = s2[i + 1];
                if (i % 2 == 0)s1[i] += nums[i + 1] - nums[i];
                else s2[i] += nums[i + 1] - nums[i];
            }

            int res = s1[0];

            for (int i = 0; i < n; i++){
                int temp = nums[i + 1] - nums[i];
                if (temp == 1)continue;
                res = Math.max(res,s1[0] - s1[i] + s2[i + 1] + temp - 1);
            }

            System.out.println(res);
        }

        in.close();
    }
}
